---
name: "pg_autoctl show events"
section: "1"
platform: "linux"
package: "pg-auto-failover-cli"
version: "2.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pg_autoctl show events"
---

# pg\_autoctl show events(1)

pg\_autoctl show events pg\_autoctl show events - Prints monitor's state of nodes in a given formation and group

## NAME

pg\_autoctl show events - pg\_autoctl show events

pg\_autoctl show events - Prints monitor's state of nodes in a given formation and group

## SYNOPSIS

This command outputs the events that the pg\_auto\_failover events records about state changes of the pg\_auto\_failover nodes managed by the monitor:

```
usage: pg_autoctl show events  [ --pgdata --formation --group --count ]
--pgdata      path to data directory
--monitor     pg_auto_failover Monitor Postgres URL
--formation   formation to query, defaults to 'default'
--group       group to query formation, defaults to all
--count       how many events to fetch, defaults to 10
--watch       display an auto-updating dashboard
--json        output data in the JSON format
```

## OPTIONS

- **--pgdata**

  Location of the Postgres node being managed locally. Defaults to the environment variable **PGDATA**. Use **--monitor** to connect to a monitor from anywhere, rather than the monitor URI used by a local Postgres node managed with **pg\_autoctl**.

- **--monitor**

  Postgres URI used to connect to the monitor. Must use the **autoctl\_node** username and target the **pg\_auto\_failover** database name. It is possible to show the Postgres URI from the monitor node using the command *pg\_autoctl show uri*.

- **--formation**

  List the events recorded for nodes in the given formation. Defaults to **default**.

- **--count**

  By default only the last 10 events are printed.

- **--watch**

  Take control of the terminal and display the current state of the system and the last events from the monitor. The display is updated automatically every 500 milliseconds (half a second) and reacts properly to window size change.

  Depending on the terminal window size, a different set of columns is visible in the state part of the output. See *pg\_autoctl watch*.

- **--json**

  Output a JSON formatted data instead of a table formatted list.

## ENVIRONMENT

PGDATA

Postgres directory location. Can be used instead of the **--pgdata** option.

PG\_AUTOCTL\_MONITOR

Postgres URI to connect to the monitor node, can be used instead of the **--monitor** option.

XDG\_CONFIG\_HOME

The pg\_autoctl command stores its configuration files in the standard place XDG\_CONFIG\_HOME. See the *XDG Base Directory Specification*.

XDG\_DATA\_HOME

The pg\_autoctl command stores its internal states files in the standard place XDG\_DATA\_HOME, which defaults to **~/.local/share**. See the *XDG* *Base Directory Specification*.

## EXAMPLES

```
$ pg_autoctl show events --count 2 --json
[
 {
     "nodeid": 1,
     "eventid": 15,
     "groupid": 0,
     "nodehost": "localhost",
     "nodename": "node1",
     "nodeport": 5501,
     "eventtime": "2021-03-18T12:32:36.103467+01:00",
     "goalstate": "primary",
     "description": "Setting goal state of node 1 \"node1\" (localhost:5501) to primary now that at least one secondary candidate node is healthy.",
     "formationid": "default",
     "reportedlsn": "0/4000060",
     "reportedstate": "wait_primary",
     "reportedrepstate": "async",
     "candidatepriority": 50,
     "replicationquorum": true
 },
 {
     "nodeid": 1,
     "eventid": 16,
     "groupid": 0,
     "nodehost": "localhost",
     "nodename": "node1",
     "nodeport": 5501,
     "eventtime": "2021-03-18T12:32:36.215494+01:00",
     "goalstate": "primary",
     "description": "New state is reported by node 1 \"node1\" (localhost:5501): \"primary\"",
     "formationid": "default",
     "reportedlsn": "0/4000110",
     "reportedstate": "primary",
     "reportedrepstate": "quorum",
     "candidatepriority": 50,
     "replicationquorum": true
 }
]
```

## AUTHOR

Microsoft

## COPYRIGHT

Copyright (c) Microsoft Corporation. All rights reserved.
